<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
</head>

<body>
    <div onclick="fun1()">111</div>
    <script>
        function fun1() {
            console.log(this);
        }

        // fun1();
        var name = "小丽";
        let obj = {
            name: "小明",
            say(val) {
                console.log(this.name + val);
            },
        };
        // obj.say("aaa");
        // obj.say.call(window, "aaa");
        // obj.say.apply(window, ["aaa"]);
        //apply 和 call 都会让函数立刻执行 但是apply 如果要传参 要传一个数组

        obj.say.bind(window, "bbbb")();
        //bind 的特点是不会让函数立刻调用
    </script>
</body>

</html>